Ignore \r in output matching
authorAlex Crichton <alex@alexcrichton.com>
Wed, 25 Jun 2014 05:09:23 +0000 (22:09 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 25 Jun 2014 18:15:04 +0000 (11:15 -0700)
Windows occasionally has \r\n while everywhere else has \n. Instead of worrying
about the difference, just replace all instances of \r with nothing and rely on
matching against \n.

tests/support/mod.rs

index b8bc511421414062a6fd0945f5bc057e8630e87e..8b3c296e001a62c2ec7693fd570cec566a337481 100644 (file)
@@ -249,7 +249,9 @@ impl Execs {
                 match str::from_utf8(actual) {
                     None => Err(format!("{} was not utf8 encoded", description)),
                     Some(actual) => {
-                        ham::expect(actual == out,
+                        // Let's not deal with \r\n vs \n on windows...
+                        let actual = actual.replace("\r", "");
+                        ham::expect(actual.as_slice() == out,
                                     format!("{} was:\n\
                                             `{}`\n\n\
                                             expected:\n\